<%--
  Created by IntelliJ IDEA.
  User: AdrianJ
  Date: 2024/6/11
  Time: 16:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<jsp:useBean id="timeCorrect" class="com.whu.exp1jsp.javabean.TimeCorrect">

</jsp:useBean>

<div class="appearing-container">
    <h1>闲置广场-武汉大学</h1>
    <!--滚动-->
    <div class="scroll-container">
        <c:forEach var="item" items="${products}">
            <div class="procuct-container">
                <!--背景-->
                <div class="block-back">
                    <img src="${item.productImgs}" alt="Product Image">
                    <div></div>
                </div>
                <!--图片-->
                <div class="block-img">
                    <img src="${item.productImgs}" alt="Product Image">
                </div>
                <!--基础信息容器-->
                <div class="block-basic">
                    <h2>${item.productPrice}</h2>
                    <h3>${item.productTitle}</h3>
                    <h4>发布时间：${timeCorrect.correctTime(item.publishTime)}</h4>
                    <h4>地址：${item.location}</h4>
                    <form action="purchase-servlet" method="post" style="display:inline;">
                        <input type="hidden"name="origin" value="cart">
                        <input type="hidden" name="productId" value="${item.productId}">
                        <button type="submit">直接购买</button>
                    </form>
                    <form action="add-to-cart-servlet" method="post" style="display:inline;">
                        <input type="hidden" name="productId" value="${item.productId}">
                        <button type="submit">加入购物车</button>
                    </form>
                </div>
                <!--介绍容器-->
                <div class="block-intro">
                        ${item.productIntro}
                </div>
            </div>
        </c:forEach>
    </div>
</div>
